import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class findSum {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        int sum = 0;
        int[] arr = new int[]{534, 386, 319, 692, 169, 338, 521, 713, 640, 692, 969, 362, 311, 349, 308, 357, 515, 140, 591, 216,

                57, 252, 575, 630, 95, 274, 328, 614, 18, 605, 17, 980, 166, 112, 997, 37, 584, 64, 442, 495,

                821, 459, 453, 597, 187, 734, 827, 950, 679, 78, 769, 661, 452, 983, 356, 217, 394, 342, 697, 878,

                475, 250, 468, 33, 966, 742, 436, 343, 255, 944, 588, 734, 540, 508, 779, 881, 153, 928, 764, 703,

                459, 840, 949, 500, 648, 163, 547, 780, 749, 132, 546, 199, 701, 448, 265, 263, 87, 45, 828, 634};
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] % 24 == 23){
                list.add(arr[i]);
            }
            sum += arr[i];
        }
        Scanner scanner = new Scanner(System.in);
        System.out.println(list);
        Arrays.sort(arr);
        System.out.println(sum - arr[0]);
    }
}
